
<#include "header.ftl">
  <!-- 内容区域 -->
<div class="tpl-content-wrapper">

   <div class="container-fluid am-cf">
                <div class="row">
                   <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        <ol class="am-breadcrumb">
						  <li><a href="${Domain}my" class="am-icon-home">首页</a></li>
						  <li ><a href="${Domain}my/advice/list">建议</a></li>
						  <li class="am-active">添加建议</li>
						</ol>
                    </div>
                  	<#include "../common/return.ftl">
                </div>
</div>
  <div class="row-content am-cf">
  
  

          <div class="row">

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">添加问题建议</div>
                                
                            </div>
                            <div class="widget-body am-fr">

                                <form class="am-form tpl-form-line-form"  method="post" action="${Domain}api/advice/add" id="advice-add" >
                                    
                                  <input type="hidden" id="id" name="id" value="">
                                    <input type="hidden" id="question" name="question" value="${question.id}">
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">问题</label>
                                        <div class="am-u-sm-8 am-u-md-6 am-form-group tpl-table-list-select">   
										  <div class="tngou-show"> ${question.name}</div>
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">值</label>
                                         <div class="am-u-sm-8 am-u-md-6 am-form-group tpl-table-list-select">
                                        <#switch question.type>
									     <#case 0>
									         <select data-am-selected="{btnSize: 'sm'}" name="value" id="value">                                           
												  <option value="1"  >是</option> 
									             	  <option value="0"  >否</option> 	          
											  </select>							    
										  <#break>
										   <#case 1>											   
										       <select data-am-selected="{btnSize: 'sm'}" name="value" id="value">
		                                         <#list list as item>
												  <option value="${item.id}"  >${item.name}</option> 
									             </#list>				          												 </select>
											 
										  <#break>
										  <#case 2>
											    <select data-am-selected="{btnSize: 'sm'}" name="value" id="value">                                       
		                                         <#list list as item>
												  <option value="${item.id}"  >${item.name}</option> 
									             </#list>				          
												 </select>
										  <#break>
									     <#case 3>
											   
										      <input type="number" style="width:33.3%"  name="value"  class="tngou-input">
											
										  <#break>
										  <#case 4>
										      
										  <#break>
									     <#default>
									       
									     </#switch>
                                       
                                         

                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    
                                     <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">建议名称 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="text" class="tpl-form-input" id="name" name="name" placeholder="请输入建议名称"  required/>                                   
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>

                                    
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">分数值 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="number" class="tpl-form-input" id="score" name="score" step="0.01" placeholder="请输扣分"  required/>
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
									 
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">说明简介</label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <textarea class="" rows="3" id="main-description" name="description"  placeholder="请输入建议介绍"></textarea>
                                        </div>
                                         <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    
                                    <div class="am-form-group">
                                        <div class="am-u-sm-6 am-u-sm-push-3">
                                            <button type="submit" id="sub" class="am-btn page-header-button tpl-btn-bg-color-success am-btn-block">保存</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
        
         
        
            
   </div>
</div>        

<script type="text/javascript">
  var loading; 
 
   $('#advice-add').ajaxForm({
	    beforeSubmit: function(a,f,o) {
	        loading=weui.loading('数据加载中...');
	    },
	    success: function(json) {	    	
	    	if(json.status)
	    	{
	    	  	if(loading)loading.hide();
	    		weui.toast("添加成功！"); 
	    		if($("#id").val()=="") 
	    		$("#id").val(json.msg);
	    		$("#sub").text("编辑");
	    		$('#advice-add').attr("action","${Domain}api/answer/update");
	    		<#if ask.url??>
	    		location.href="${ask.url}";	
	    		</#if>			
	    	}else
	    	{	
	    		if(loading)loading.hide();
	    	    weui.alert(json.msg);  		 
	    	}
	    }
	});
	</script>
<#include "footer.ftl">